import { RoutesService, eLayoutType } from '@abp/ng.core';
import { APP_INITIALIZER } from '@angular/core';
import { Injectable } from '@angular/core';

export const APP_ROUTE_PROVIDER = [
  { provide: APP_INITIALIZER, useFactory: configureRoutes, deps: [RoutesService], multi: true },
];

@Injectable()
export class RouteProvider {
  constructor(private routerConfigService: RoutesService) {
    routerConfigService.add([
      {
        path: '/',
        name: '::Menu:Home',
        iconClass: 'fas fa-home',
        order: 1,
      },
      {
        path: '/books',
        name: '::Menu:BookStore',
        iconClass: 'fas fa-book',
        order: 2,
      },
      {
        path: undefined,
        name: '客户管理',
        iconClass: 'fas fa-users',
        order: 3,
      },
      {
        path: '/kehus',
        name: '客户表',
        iconClass: 'fas fa-user',
        order: 1,
        parentName: '客户管理',
      },
      {
        path: '/products',
        name: '商品明细',
        iconClass: 'fas fa-box',
        order: 2,
        parentName: '客户管理',
      },
      {
        path: '/shops',
        name: '商品表',
        iconClass: 'fas fa-boxes',
        order: 3,
        parentName: '客户管理',
      },
      {
        path: '/gongyings',
        name: '供应商表',
        iconClass: 'fas fa-truck',
        order: 4,
        parentName: '客户管理',
      },
      {
        path: undefined,
        name: '进货管理',
        iconClass: 'fas fa-shopping-cart',
        order: 4,
      },
      {
        path: '/purchase/customergoods',
        name: '客户进货',
        iconClass: 'fas fa-user-plus',
        order: 1,
        parentName: '进货管理',
      },
      {
        path: '/vehicle',
        name: '车辆管理',
        iconClass: 'fas fa-car',
        order: 5,
      },
      {
        path: '/orders',
        name: '订单管理',
        iconClass: 'fas fa-list',
        order: 6,
      },
      {
        path: '/admanagement',
        name: 'AD管理',
        iconClass: 'fas fa-ad',
        order: 7,
      },
      {
        path: '/fleetcar',
        name: '车队管理',
        iconClass: 'fas fa-truck',
        order: 8,
      },
    ]);
  }
}

function configureRoutes(routesService: RoutesService) {
  return () => {
    routesService.add([
      {
        path: '/',
        name: '::Menu:Home',
        iconClass: 'fas fa-home',
        order: 1,
        layout: eLayoutType.application,
      },
      {
        path: undefined,
        name: '客户管理',
        iconClass: 'fas fa-users',
        order: 2,
        layout: eLayoutType.application,
      },
      {
        path: '/kehus',
        name: '客户表',
        iconClass: 'fas fa-user',
        order: 1,
        layout: eLayoutType.application,
        parentName: '客户管理'
      },
      {
        path: '/products',
        name: '商品明细',
        iconClass: 'fas fa-box',
        order: 2,
        layout: eLayoutType.application,
        parentName: '客户管理'
      },
      {
        path: '/shops',
        name: '商品表',
        iconClass: 'fas fa-boxes',
        order: 3,
        layout: eLayoutType.application,
        parentName: '客户管理'
      },
      {
        path: '/gongyings',
        name: '供应商表',
        iconClass: 'fas fa-truck',
        order: 4,
        layout: eLayoutType.application,
        parentName: '客户管理'
      },
      {
        path: undefined,
        name: '进货管理',
        iconClass: 'fas fa-shopping-cart',
        order: 2,
        layout: eLayoutType.application,
      },
      {
        path: '/purchase/customergoods',
        name: '客户进货',
        iconClass: 'fas fa-user-plus',
        order: 1,
        layout: eLayoutType.application,
        parentName:'进货管理'
      },
      {
        path: '/purchase/otherwarehousing',
        name: '其它入库',
        iconClass: 'fas fa-box',
        order: 2,
        layout: eLayoutType.application,
        parentName: '进货管理'
      },
      {
        path: '/purchase/notification-order',
        name: '进货通知明细',
        iconClass: 'fa fa-clipboard-list',
        order: 3,
        layout: eLayoutType.application,
        parentName: '进货管理'
      },
      {
        path: '/purchase/receipt-order',
        name: '收货登记',
        iconClass: 'fa fa-check-square',
        order: 4,
        layout: eLayoutType.application,
        parentName: '进货管理'
      },
      {
        path: '/transport',
        name: '运输管理',
        iconClass: 'fas fa-truck',
        order: 4,
        layout: eLayoutType.application,
        parentName: undefined,
      },
      {
        path: '/vehicle',
        name: '车辆管理',
        iconClass: 'fas fa-car',
        order: 1,
        parentName: '运输管理',
        layout: eLayoutType.application,
      },{
        path: '/admanagement',
        name: '地址管理',
        iconClass: 'fas fa-map-marker-alt',
        order: 2,
        parentName: '运输管理',
        layout: eLayoutType.application,
      },
      {
        path: '/orders',
        name: '订单管理',
        iconClass: 'fa fa-box',
        order: 3,
        parentName: '运输管理',
        layout: eLayoutType.application,
      },{
        path: '/fleetcar',
        name: '派车管理',
        iconClass: 'fa fa-pallet',
        order: 4,
        parentName: '运输管理',
        layout: eLayoutType.application,
      },
      {
        path: '/carinventry',
        name: '派车明细',
        iconClass: 'fa fa-route',
        order: 5,
        parentName: '运输管理',
        layout: eLayoutType.application,
      },
      {
        path: '/storehouse',
        name: '仓库管理',
        iconClass: 'fas fa-warehouse',
        order: 2,
        layout: eLayoutType.application,
      },
      {
        path: '/ruku',
        name: '入库管理',
        iconClass: 'fas fa-inbox',
        order: 3,
        layout: eLayoutType.application,
      },
      {
        path: '/inventoryTransfer_zmy',
        name: '调拨管理',
        iconClass: 'fa fa-exchange-alt',
        order: 1,
        layout: eLayoutType.application,
      },
      {
        path: '/inventoryTransfer',
        name: '库存调拨',
        iconClass: 'fa fa-exchange-alt',
        order: 1,
        parentName: '调拨管理',
        layout: eLayoutType.application,
      },
      {
        path: '/inventoryTransferdetail',
        name: '库存调拨详情',
        iconClass: 'fa fa-exchange-alt',
        order: 2,
        parentName: '调拨管理',
        layout: eLayoutType.application,
      },
      {
        path: undefined,
        name: 'RFID管理',
        iconClass: 'fas fa-wifi',
        order: 5,
        layout: eLayoutType.application,
      },
      {
        path: '/rfids',
        name: 'RFID列表',
        iconClass: 'fas fa-table',
        order: 1,
        parentName: 'RFID管理',
        layout: eLayoutType.application,
      },
      {
        path: '/Merchandise',
        name: 'RFID列表',
        iconClass: 'fas fa-table',
        order: 1,
        parentName: 'RFID管理',
        layout: eLayoutType.application,
      },
    ]);
  };
}
